3.2.61 \(\int \csc (e+f x) (a+b \sin (e+f x))^2 \, dx\) [161]

Optimal. Leaf size=35 \[ 2 a b x-\frac {a^2 \tanh ^{-1}(\cos (e+f x))}{f}-\frac {b^2 \cos (e+f x)}{f} \]

[Out]

2*a*b*x-a^2*arctanh(cos(f*x+e))/f-b^2*cos(f*x+e)/f

________________________________________________________________________________________

Rubi [A]
time = 0.04, antiderivative size = 35, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, integrand size = 19, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.158, Rules used = {2825, 2814, 3855} \begin {gather*} -\frac {a^2 \tanh ^{-1}(\cos (e+f x))}{f}+2 a b x-\frac {b^2 \cos (e+f x)}{f} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[Csc[e + f*x]*(a + b*Sin[e + f*x])^2,x]

[Out]

2*a*b*x - (a^2*ArcTanh[Cos[e + f*x]])/f - (b^2*Cos[e + f*x])/f

Rule 2814

Int[((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])/((c_.) + (d_.)*sin[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[b*(x/d)
, x] - Dist[(b*c - a*d)/d, Int[1/(c + d*Sin[e + f*x]), x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d
, 0]

Rule 2825

Int[((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])^2/((c_.) + (d_.)*sin[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(-b^2
)*(Cos[e + f*x]/(d*f)), x] + Dist[1/d, Int[Simp[a^2*d - b*(b*c - 2*a*d)*Sin[e + f*x], x]/(c + d*Sin[e + f*x]),
 x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0]

Rule 3855

Int[csc[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-ArcTanh[Cos[c + d*x]]/d, x] /; FreeQ[{c, d}, x]

Rubi steps

\begin {align*} \int \csc (e+f x) (a+b \sin (e+f x))^2 \, dx &=-\frac {b^2 \cos (e+f x)}{f}+\int \csc (e+f x) \left (a^2+2 a b \sin (e+f x)\right ) \, dx\\ &=2 a b x-\frac {b^2 \cos (e+f x)}{f}+a^2 \int \csc (e+f x) \, dx\\ &=2 a b x-\frac {a^2 \tanh ^{-1}(\cos (e+f x))}{f}-\frac {b^2 \cos (e+f x)}{f}\\ \end {align*}

________________________________________________________________________________________

Mathematica [B] Leaf count is larger than twice the leaf count of optimal. \(76\) vs. \(2(35)=70\).
time = 0.02, size = 76, normalized size = 2.17 \begin {gather*} 2 a b x-\frac {b^2 \cos (e) \cos (f x)}{f}-\frac {a^2 \log \left (\cos \left (\frac {e}{2}+\frac {f x}{2}\right )\right )}{f}+\frac {a^2 \log \left (\sin \left (\frac {e}{2}+\frac {f x}{2}\right )\right )}{f}+\frac {b^2 \sin (e) \sin (f x)}{f} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[Csc[e + f*x]*(a + b*Sin[e + f*x])^2,x]

[Out]

2*a*b*x - (b^2*Cos[e]*Cos[f*x])/f - (a^2*Log[Cos[e/2 + (f*x)/2]])/f + (a^2*Log[Sin[e/2 + (f*x)/2]])/f + (b^2*S
in[e]*Sin[f*x])/f

________________________________________________________________________________________

Maple [A]
time = 0.20, size = 46, normalized size = 1.31

method result size
derivativedivides \(\frac {a^{2} \ln \left (\csc \left (f x +e \right )-\cot \left (f x +e \right )\right )+2 a b \left (f x +e \right )-\cos \left (f x +e \right ) b^{2}}{f}\) \(46\)
default \(\frac {a^{2} \ln \left (\csc \left (f x +e \right )-\cot \left (f x +e \right )\right )+2 a b \left (f x +e \right )-\cos \left (f x +e \right ) b^{2}}{f}\) \(46\)
risch \(2 a b x -\frac {b^{2} {\mathrm e}^{i \left (f x +e \right )}}{2 f}-\frac {b^{2} {\mathrm e}^{-i \left (f x +e \right )}}{2 f}+\frac {a^{2} \ln \left ({\mathrm e}^{i \left (f x +e \right )}-1\right )}{f}-\frac {a^{2} \ln \left ({\mathrm e}^{i \left (f x +e \right )}+1\right )}{f}\) \(80\)
norman \(\frac {\frac {2 b^{2} \left (\tan ^{4}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{f}+2 a b x +\frac {2 b^{2} \left (\tan ^{2}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{f}+4 a b x \left (\tan ^{2}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )+2 a b x \left (\tan ^{4}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{\left (1+\tan ^{2}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )^{2}}+\frac {a^{2} \ln \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{f}\) \(111\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(csc(f*x+e)*(a+b*sin(f*x+e))^2,x,method=_RETURNVERBOSE)

[Out]

1/f*(a^2*ln(csc(f*x+e)-cot(f*x+e))+2*a*b*(f*x+e)-cos(f*x+e)*b^2)

________________________________________________________________________________________

Maxima [A]
time = 0.28, size = 48, normalized size = 1.37 \begin {gather*} \frac {2 \, {\left (f x + e\right )} a b - b^{2} \cos \left (f x + e\right ) - a^{2} \log \left (\cot \left (f x + e\right ) + \csc \left (f x + e\right )\right )}{f} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(csc(f*x+e)*(a+b*sin(f*x+e))^2,x, algorithm="maxima")

[Out]

(2*(f*x + e)*a*b - b^2*cos(f*x + e) - a^2*log(cot(f*x + e) + csc(f*x + e)))/f

________________________________________________________________________________________

Fricas [A]
time = 0.39, size = 57, normalized size = 1.63 \begin {gather*} \frac {4 \, a b f x - 2 \, b^{2} \cos \left (f x + e\right ) - a^{2} \log \left (\frac {1}{2} \, \cos \left (f x + e\right ) + \frac {1}{2}\right ) + a^{2} \log \left (-\frac {1}{2} \, \cos \left (f x + e\right ) + \frac {1}{2}\right )}{2 \, f} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(csc(f*x+e)*(a+b*sin(f*x+e))^2,x, algorithm="fricas")

[Out]

1/2*(4*a*b*f*x - 2*b^2*cos(f*x + e) - a^2*log(1/2*cos(f*x + e) + 1/2) + a^2*log(-1/2*cos(f*x + e) + 1/2))/f

________________________________________________________________________________________

Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \left (a + b \sin {\left (e + f x \right )}\right )^{2} \csc {\left (e + f x \right )}\, dx \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(csc(f*x+e)*(a+b*sin(f*x+e))**2,x)

[Out]

Integral((a + b*sin(e + f*x))**2*csc(e + f*x), x)

________________________________________________________________________________________

Giac [A]
time = 0.46, size = 52, normalized size = 1.49 \begin {gather*} \frac {2 \, {\left (f x + e\right )} a b + a^{2} \log \left ({\left | \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) \right |}\right ) - \frac {2 \, b^{2}}{\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} + 1}}{f} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(csc(f*x+e)*(a+b*sin(f*x+e))^2,x, algorithm="giac")

[Out]

(2*(f*x + e)*a*b + a^2*log(abs(tan(1/2*f*x + 1/2*e))) - 2*b^2/(tan(1/2*f*x + 1/2*e)^2 + 1))/f

________________________________________________________________________________________

Mupad [B]
time = 6.48, size = 125, normalized size = 3.57 \begin {gather*} \frac {a^2\,\ln \left (\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )\right )}{f}-\frac {2\,b^2}{f\,\left ({\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^2+1\right )}+\frac {4\,a\,b\,\mathrm {atan}\left (\frac {16\,a^2\,b^2}{8\,a^3\,b-16\,a^2\,b^2\,\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}+\frac {8\,a^3\,b\,\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}{8\,a^3\,b-16\,a^2\,b^2\,\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}\right )}{f} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a + b*sin(e + f*x))^2/sin(e + f*x),x)

[Out]

(a^2*log(tan(e/2 + (f*x)/2)))/f - (2*b^2)/(f*(tan(e/2 + (f*x)/2)^2 + 1)) + (4*a*b*atan((16*a^2*b^2)/(8*a^3*b -
 16*a^2*b^2*tan(e/2 + (f*x)/2)) + (8*a^3*b*tan(e/2 + (f*x)/2))/(8*a^3*b - 16*a^2*b^2*tan(e/2 + (f*x)/2))))/f

________________________________________________________________________________________